package com.lyn.plugin.entity;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;

import dalvik.system.DexClassLoader;

public class Plugin {
    public Activity activity;
    public String packageName;
    public String launcherClassName;
    public String name;
    public Drawable logo;
    public String path;
    public Resources resources;
    public DexClassLoader classLoader;

    public Plugin(Builder builder) {
        this.activity = builder.activity;
        this.packageName = builder.packageName;
        this.launcherClassName = builder.launcherClassName;
        this.name = builder.name;
        this.logo = builder.logo;
        this.path = builder.path;
        this.resources = builder.resources;
        this.classLoader = builder.classLoader;
    }

    public static class Builder {
        private Activity activity;
        private String packageName;
        private String launcherClassName;
        private String name;
        private Drawable logo;
        private String path;
        private Resources resources;
        private DexClassLoader classLoader;

        public Builder setActivity(Activity activity) {
            this.activity = activity;
            return this;
        }

        public Builder setPackageName(String packageName) {
            this.packageName = packageName;
            return this;
        }

        public Builder setLauncherClassName(String launcherClassName) {
            this.launcherClassName = launcherClassName;
            return this;
        }

        public Builder setName(String name) {
            this.name = name;
            return this;
        }

        public Builder setLogo(Drawable logo) {
            this.logo = logo;
            return this;
        }

        public Builder setPath(String path) {
            this.path = path;
            return this;
        }

        public Builder setResources(Resources resources) {
            this.resources = resources;
            return this;
        }

        public Builder setClassLoader(DexClassLoader classLoader) {
            this.classLoader = classLoader;
            return this;
        }

        public Plugin create(){
            return new Plugin(this);
        }
    }
}
